<template>
	<z-nav-bar title="球员评测" transparentTitle="auto"></z-nav-bar>
	<view class="cp-top">
		<view class="cp-top-tit flex_fsc">
			<text>实战测试</text>
			<text class="lab">{{ data.data.dictLabel }}</text>
		</view>
		<view class="cp-time">测试时间：{{ data.createTime }}</view>
		<view class="cp-time">测评球员：{{ data.playerInfo.name }}</view>
		<view class="cp-gz">{{ data.data.remark }}</view>
	</view>
	<view class="cp-score">
		<view class="cp-score-tit">成绩结果</view>
		<uni-table ref="table" border stripe emptyText="暂无更多数据">
			<uni-tr class="uni-color-main-bg">
				<uni-th align="center">
					<view class="z-font-24 uni-white">评测项目</view>
				</uni-th>
				<uni-th align="center">
					<view class="uni-white">值</view>
				</uni-th>
			</uni-tr>
			<uni-tr>
				<uni-td align="center" class="z-font-24">{{ data.list[0].dictLabel }}</uni-td>
				<uni-td align="center">{{ data.list[0].value }}</uni-td>
			</uni-tr>
			<uni-tr>
				<uni-td align="center" class="z-font-24">评价得分</uni-td>
				<uni-td align="center">
					<view class="flex_cc">
						<uni-rate
							size="12"
							v-model="data.score"
							color="#E1E3E6"
							active-color="#FF7742"
							:readonly="true"
						/>
					</view>
				</uni-td>
			</uni-tr>
		</uni-table>
		<view class="cp-score-tit">详细结果</view>
		<uni-table ref="table" border stripe emptyText="暂无更多数据">
			<uni-tr class="uni-color-main-bg">
				<uni-th align="center" width="168rpx">
					<view class="z-font-24 uni-white">评测项目</view>
				</uni-th>
				<uni-th align="center" width="168rpx">
					<view class="uni-white">值</view>
				</uni-th>
				<uni-th align="center" width="168rpx">
					<view class="uni-white">评分</view>
				</uni-th>
				<uni-th align="center" width="168rpx">
					<view class="uni-white">失误点</view>
				</uni-th>
			</uni-tr>
			<uni-tr v-for="(item, index) in data.list" :key="item.id">
				<uni-td align="center" class="z-font-24">{{ item.dictLabel }}</uni-td>
				<uni-td align="center">
					<view v-if="item.children[0].dictLabel == '值'">
						<view v-if="item.children[0].hasChildren" class="z-font-24">
							<text>
								{{
									typeof item.value === 'number'
										? item.children[0].children[item.value].dictLabel
										: '选择'
								}}
							</text>
						</view>
						<view v-else class="z-font-24 flex_cc">
							<view class="z-font-24">{{ item.value || '--' }}</view>
							<view>{{ item.children[0].dictExtS }}</view>
						</view>
					</view>
					<view v-else>--</view>
				</uni-td>
				<uni-td align="center">
					<uni-rate
						size="12"
						v-model="item.markValue"
						color="#E1E3E6"
						active-color="#FF7742"
						:readonly="true"
					/>
				</uni-td>
				<uni-td align="center">
					<view
						v-if="
							item.children[0].dictLabel == '失误点' ||
							(item.children[1] && item.children[1].dictLabel == '失误点') ||
							(item.children[2] && item.children[2].dictLabel == '失误点')
						"
					>
						<view class="z-font-24">
							<text>
								{{
									typeof item.mistake === 'number'
										? item.children.filter((el) => el.dictLabel == '失误点')[0].children[
												item.mistake
										  ].dictLabel
										: '选择'
								}}
							</text>
						</view>
					</view>
					<view v-else>--</view>
				</uni-td>
			</uni-tr>
		</uni-table>
		<view class="uni-pb-32"></view>
	</view>
</template>

<script setup>
import { onShow } from '@dcloudio/uni-app';
import { ref, reactive, getCurrentInstance } from 'vue';
const { proxy: that } = getCurrentInstance();
const data = uni.getStorageSync('local-evaluation');
console.log(data);
</script>

<style lang="scss">
@import 'evaluation-szresult.scss';
page {
	background: linear-gradient(to bottom, #f9f1e9 0, #f9f1e9 500rpx, #ffffff 500rpx, #ffffff 100%);
	background-attachment: fixed;
}
</style>
